$(document).ready(function(){
    MSIE8 = ($.browser.msie) && ($.browser.version == 8),
	$.fn.ajaxJSSwitch({
		topMargin: 449,//mandatory property for decktop
		bottomMargin: 139,//mandatory property for decktop
		topMarginMobileDevices: 449,//mandatory property for mobile devices
		bottomMarginMobileDevices: 139,//mandatory property for mobile devices
        delaySubMenuHide: 300,
        bodyMinHeight: 1000,
		menuInit:function (classMenu, classSubMenu){
		},
		buttonOver:function (item){
            item.parent().addClass('hover');
		},
		buttonOut:function (item){
			item.parent().removeClass('hover');
		},
		subMenuButtonOver:function (item){
		},
		subMenuButtonOut:function (item){
		},
		subMenuShow:function(subMenu){
        	subMenu.stop(true,true).animate({"opacity":"show"}, 400, "easeOutCubic");
		},
		subMenuHide:function(subMenu){
        	subMenu.stop(true,true).animate({"opacity":"hide"}, 500, "easeOutCubic");
		},
		pageInit:function (pages){
		},
		currPageAnimate:function (page){
			$('h1.brand').stop(true,true).animate({'marginTop':'11px'})
				.find('>a').stop(true,true).animate({'height':358}).end()
				.find('>a>img:first-child').stop(true,true).animate({'height':182, 'width':182, 'marginBottom': 11})
			$('.sf-menu').stop(true,true).animate({'marginTop':224});
			$('.content_bg').stop(true,true).animate({'opacity':1})

            page.css({"left":$(window).width()}).stop(true).delay(300).animate({"left":0}, 1000, "easeOutCubic");
		},
		prevPageAnimate:function (page){
            page.stop(true).animate({"display":"block", "left":-$(window).outerWidth()*2}, 700, "easeInCubic");
		},
		backToSplash:function (){
			var delay = 500;
			$('h1.brand').stop(true,true).delay(delay).animate({'marginTop':'204px'},500,'easeOutCubic')
				.find('>a').stop(true,true).delay(delay).animate({'height':446},500,'easeOutCubic').end()
				.find('>a>img:first-child').stop(true,true).delay(delay).animate({'height':240, 'width':240, 'marginBottom': 31},500,'easeOutCubic')
			$('.sf-menu').stop(true,true).delay(delay+100).animate({'marginTop':495},500,'easeOutCubic');
			$('.content_bg').stop(true,true).delay(delay).animate({'opacity':0});
		},
		pageLoadComplete:function (){
			$('.list1>li>a, .list3>li>a')
			.prepend('<span class="sitem_over"><strong></strong></span>')
			.attr('rel','appendix').fancybox();
        }
	});
    
	jQuery.i18n.properties({
		name:'Messages',
		path:'assets/i18n/',
		mode: 'map',
		encoding: 'UTF-8',
        callback: function () {
        	console.log("Loaded i18n file...");
        }
	});
	
	var i18nViewModel = {
		    i18nTranslateText: function(key) {
		        return jQuery.i18n.prop(key);
		    }
	};
	
	ko.applyBindings(i18nViewModel);

})
$(window).load(function(){
    setTimeout(function (){ $(window).trigger('resize') },600)
    
    $(".image_resize").image_resize({});

    $('.sf-menu>li>a').each(function () {
    	$(this).append('<span>'+$('>span',this).text()+'</span>');
    })

	$("#webSiteLoader").delay(500).animate({opacity:0}, 600, "easeInCubic", function(){$("#webSiteLoader").remove()});
});